/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.jPanels;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Gean
 */
@Entity
@Table(name = "notafiscal", catalog = "", schema = "")
@NamedQueries({
    @NamedQuery(name = "Notafiscal.findAll", query = "SELECT n FROM Notafiscal n"),
    @NamedQuery(name = "Notafiscal.findByNumNotaFiscal", query = "SELECT n FROM Notafiscal n WHERE n.numNotaFiscal = :numNotaFiscal"),
    @NamedQuery(name = "Notafiscal.findByNumEmpenho", query = "SELECT n FROM Notafiscal n WHERE n.numEmpenho = :numEmpenho"),
    @NamedQuery(name = "Notafiscal.findByDtEmissao", query = "SELECT n FROM Notafiscal n WHERE n.dtEmissao = :dtEmissao"),
    @NamedQuery(name = "Notafiscal.findByValorTotal", query = "SELECT n FROM Notafiscal n WHERE n.valorTotal = :valorTotal"),
    @NamedQuery(name = "Notafiscal.findByCnpj", query = "SELECT n FROM Notafiscal n WHERE n.cnpj = :cnpj")})
public class Notafiscal implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NumNotaFiscal")
    private String numNotaFiscal;
    @Basic(optional = false)
    @Column(name = "NumEmpenho")
    private String numEmpenho;
    @Basic(optional = false)
    @Column(name = "DtEmissao")
    @Temporal(TemporalType.DATE)
    private Date dtEmissao;
    @Basic(optional = false)
    @Column(name = "ValorTotal")
    private float valorTotal;
    @Basic(optional = false)
    @Column(name = "CNPJ")
    private String cnpj;

    public Notafiscal() {
    }

    public Notafiscal(String numNotaFiscal) {
        this.numNotaFiscal = numNotaFiscal;
    }

    public Notafiscal(String numNotaFiscal, String numEmpenho, Date dtEmissao, float valorTotal, String cnpj) {
        this.numNotaFiscal = numNotaFiscal;
        this.numEmpenho = numEmpenho;
        this.dtEmissao = dtEmissao;
        this.valorTotal = valorTotal;
        this.cnpj = cnpj;
    }

    public String getNumNotaFiscal() {
        return numNotaFiscal;
    }

    public void setNumNotaFiscal(String numNotaFiscal) {
        String oldNumNotaFiscal = this.numNotaFiscal;
        this.numNotaFiscal = numNotaFiscal;
        changeSupport.firePropertyChange("numNotaFiscal", oldNumNotaFiscal, numNotaFiscal);
    }

    public String getNumEmpenho() {
        return numEmpenho;
    }

    public void setNumEmpenho(String numEmpenho) {
        String oldNumEmpenho = this.numEmpenho;
        this.numEmpenho = numEmpenho;
        changeSupport.firePropertyChange("numEmpenho", oldNumEmpenho, numEmpenho);
    }

    public Date getDtEmissao() {
        return dtEmissao;
    }

    public void setDtEmissao(Date dtEmissao) {
        Date oldDtEmissao = this.dtEmissao;
        this.dtEmissao = dtEmissao;
        changeSupport.firePropertyChange("dtEmissao", oldDtEmissao, dtEmissao);
    }

    public float getValorTotal() {
        return valorTotal;
    }

    public void setValorTotal(float valorTotal) {
        float oldValorTotal = this.valorTotal;
        this.valorTotal = valorTotal;
        changeSupport.firePropertyChange("valorTotal", oldValorTotal, valorTotal);
    }

    public String getCnpj() {
        return cnpj;
    }

    public void setCnpj(String cnpj) {
        String oldCnpj = this.cnpj;
        this.cnpj = cnpj;
        changeSupport.firePropertyChange("cnpj", oldCnpj, cnpj);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numNotaFiscal != null ? numNotaFiscal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Notafiscal)) {
            return false;
        }
        Notafiscal other = (Notafiscal) object;
        if ((this.numNotaFiscal == null && other.numNotaFiscal != null) || (this.numNotaFiscal != null && !this.numNotaFiscal.equals(other.numNotaFiscal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "view.jPanels.Notafiscal[ numNotaFiscal=" + numNotaFiscal + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
